package com.web44.mapper;


import com.web44.bean.Emp;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * @Title: EmpMapper
 * @Description:
 * @Auther: py
 * @Version: 1.0
 * @create 2024/1/3 14:20
 */
@CacheNamespace(blocking=true)
public interface EmpMapper {



    @Select("select * from emp where empno = #{empno}")
    @Results(
            id = "empMap",
            value={
//                    @Result(id = true,column = "empno",property = "empno"),
//                    @Result(column = "ename",property = "ename"),
//                    @Result(column = "job",property = "job"),
//                    @Result(column = "mgr",property = "mgr"),
//                    @Result(column = "hiredate",property = "hiredate"),
//                    @Result(column = "sal",property = "sal"),
//                    @Result(column = "comm",property = "comm"),
//                    @Result(column = "deptno",property = "deptno"),
                    @Result(property = "dept",
                            one = @One(
                            select = "com.web44.mapper.DeptMapper.queryDeptByDeptno",
                            fetchType = FetchType.LAZY
                    ),column = "deptno"),
            }
    )
    Emp queryEmpByEmpno(@Param("empno") Integer empno);


    @Select("select * from emp where deptno = #{deptno}")
    List<Emp> queryEmpByDeptno(@Param("deptno") Integer deptno);


}
